package com.topone.repository;

import com.topone.dataObject.Bussiness;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 商家信息操作相关Dao
 * Created by Administrator on 2017/11/6,0006.
 */
@Repository
public interface BussinessRepository extends JpaRepository<Bussiness,String> {

    //根据商家code查询
    Bussiness findByBussinessCodeAndBussinessId(String bussinessCode,String bussniessId);


     Page<Bussiness> findByBussinessCode(String bussinessCode, Pageable pageable);

     Page<Bussiness> findByBussinessStatus(Integer bussinessStatus,Pageable pageable);


    //根据商家名称和优惠券名称模糊查询
//    @Modifying
//    @Query("select B.BUSSINESS_NAME,C.COUPON_NAM from TC_BUSSINESS B left join TC_COUPON C on C.BUSSINESS_ID=B.BUSSINESS_ID where C.COUPON_NAME like ?1 AND B.BUSSINESS_NAME like ?2 AND B.BUSSINESS_STATUS='A' AND C.COUPON_STATUS='A'")
//    List<Object> findByCouponAndBussinessName(String couponName, String bussinessName);
//


}
